const foo = 123

const delay = t => new Promise(resolve => setTimeout(resolve, t))

const main = async () => {
  await delay(1000)
  console.log(`hello ${foo}`)
}

main()

const obj = {}

console.log(obj?.foo?.bar)